package com.liit.module.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.liit.module.dao.ProductCategoryDao;
import com.liit.module.entity.ProductCategory;
import com.liit.module.frame.utils.page.Pagination;
import com.liit.module.service.ProductCategoryService;

/**
 * @author dingweibo
 * @Title: ProductCategoryServiceImpl.java
 * @Description: 产品类型服务实现
 * @date 2015年12月21日
 */
@Service("productCategoryService")
public class ProductCategoryServiceImpl implements ProductCategoryService {

	@Resource
	ProductCategoryDao productCategoryDao;

	@Override
	public int insertAndReturnPK(ProductCategory record) {
		productCategoryDao.insert(record);
		return record.getId();
	}

	@Override
	public ProductCategory selectById(Integer id) {
		return productCategoryDao.selectById(id);
	}

	@Override
	public int updateById(ProductCategory record) {
		return productCategoryDao.updateById(record);
	}

	@Override
	public Map<String, Object> listPage(Pagination pagination, ProductCategory record) {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("list", productCategoryDao.listPage(pagination, record));
		result.put("page", pagination);
		return result;
	}

	@Override
	public List<ProductCategory> selectCategory(Integer disabled) {
		return productCategoryDao.selectCategory(disabled);
	}
}
